import request from '@/utils/request'

// 根据供货商ID查询关联的商品列表
export function getGoodsBySupplier(supplierId) {
  return request({
    url: '/system/supplier/goods/listBySupplier',
    method: 'get',
    params: {
      supplierId
    }
  })
}

// 查询供货商商品关联列表
export function listSupplierGoods(query) {
  return request({
    url: '/system/supplier/goods/list',
    method: 'get',
    params: query
  })
}

// 查询供货商商品关联详细
export function getSupplierGoods(id) {
  return request({
    url: '/system/supplier/goods/' + id,
    method: 'get'
  })
}

// 新增供货商商品关联
export function addSupplierGoods(data) {
  return request({
    url: '/system/supplier/goods',
    method: 'post',
    data: data
  })
}

// 修改供货商商品关联
export function updateSupplierGoods(data) {
  return request({
    url: '/system/supplier/goods',
    method: 'put',
    data: data
  })
}

// 删除供货商商品关联
export function delSupplierGoods(id) {
  return request({
    url: '/system/supplier/goods/' + id,
    method: 'delete'
  })
}

// 更新供货商的商品关联（批量设置）
export function updateSupplierGoodsRelation(data) {
  return request({
    url: '/system/supplier/goods/updateRelationMini',
    method: 'post',
    data: data
  })
}